<include file="Public/header" />
 <div class="wrapper wrapper-content">
        <div class="row" style="background:#fff;">
        <div class="ibox-title">
            <h5>文章处理</h5>
          
        </div>
            <div class="ibox-content">

                        <table class="table table-striped table-bordered table-hover dataTables-example">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>标题</th>
                                    <th>提交人信息</th>
                                    <th>步骤数</th>
                                    <th class="">时间</th>
                                     <th class="">状态</th>
                                    <th class="">是否显示</th>
                                     <th class="" style="">备注</th>
                                    <th>操作</th>
                                    
                                
                                </tr>
                            </thead>
                            <tbody>
                            
                            <?php foreach ($bugs as $key => $v): ?>
                        
                   
                        <tr class="gradeX">
                        <td>{$v.id}</td>
                             <td >{$v.title}</td>

                            <td >{$v.sub_name}:{$v.sub_phone}-{$v.sub_email}</td>
                            <td><input type="text" value="{$v.step}" bugsId = "{$v.id}"></td>
                            <td>{$v.time}</td>
                            <td><a href="javascript:;" class="btn btn-info"> 
                                <?php if($v['statues']==0){ echo "审核中";}elseif ($v['statues']==1||$v['statues']==2) {
                                  echo "已受理";
                                }elseif ($v['statues']==3) {
                                  echo "正在进行";
                                }elseif ($v['statues']==4) {
                                  echo "完成";
                                } ?>
                                </a></td>
                            <td><a href="javascript:;" class="isShow btn btn-default" bugsId = "{$v.id}" bugShow="{$v.isShow}"><?php if($v['isShow']!=0){echo "显示";}else{ echo "不显示";} ?></a></td>
                            <td><p class="prettyscroll">{$v.remark}</p></td>
                            
                              <td>
                                  <a href="{:U('SzppcatsArticle/addEdit',array('ID'=>$v['ID']))}" class="btn btn-danger btn-sm no-margin" style="margin-top:10px;">删除</a>
                                  <?php if($v['statues']==0){ ?>
                                  <!-- <a href="" class="btn btn-warning btn-sm no-margin" style="margin-top:10px;">修改</a> -->
                                  <a href="" class="btn btn-info changeStatues  btn-sm no-margin" bugsId = "{$v.id}" style="margin-top:10px;">受理</a>
                                  <?php } ?>
                                  <a href="{:U('Admin/Email/sendEmailByGet',array('email'=>$v['sub_email'],'name'=>$v['sub_name'],'url_c'=>'Admin','url_m'=>'WebServices','url_a'=>'bug'))}" class="btn btn-default  btn-sm no-margin" style="margin-top:10px;">发邮件</a>
                              </td>
                        </tr>

                    <?php endforeach ?>
                            </tbody>
                        
                        </table>

                    </div>
           
        </div>
    </div>

            <script type="text/javascript">
            $('input').blur(function(event) {
              var id = $(this).attr('bugsId');
              var step = $(this).val();
              $.ajax({
                url: '{:U('Ajax/Bug/changeStep')}',
                type: 'POST',
                dataType: 'json',
                data: {id: id,step:step},
                success:function(d){
                  
                  if(d){
                    cmzAlert('修改成功',1);
                  }
                }
              })
             
              
            });
            $('.isShow').click(function(event) {
              var id = $(this).attr('bugsId');
             var isShow = $(this).attr('bugShow');
             $.ajax({
                url: '{:U('Ajax/Bug/changeShow')}',
                type: 'POST',
                dataType: 'json',
                data: {id: id,isShow:isShow},
                success:function(d){
                  
                  if(d){
                    window.location.reload();
                  }
                }
              })
             
            });
            $('.changeStatues').click(function(event) {
             var id = $(this).attr('bugsId');
             $.ajax({
                url: '{:U('Ajax/Bug/changeStatues')}',
                type: 'POST',
                dataType: 'json',
                data: {id: id},
                success:function(d){
                  
                  if(d){
                    window.location.reload();
                  }
                }
              })
            });

            </script>
